package com.entity;

public class Cart {
	private Product product;//商品
	private int stock;	//数量
	private float price;//价格
	
	
	public Cart(Product product, int stock) {
		super();
		this.product = product;
		this.stock = stock;
		this.price = product.getPrice()*stock;	//价格=商品价格*数量
	}
	
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	public int getStock() {
		return stock;
	}
	public void setStock(int stock) {
		this.stock = stock;
		this.price = product.getPrice()*stock;	//价格=商品价格*数量
	}
	public float getPrice() {
		return price;
	}
	
}